package com.lmx.repoDomain.tmodel;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import com.lmx.repoDomain.tmodel.business.User;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiLookupIncludeAutomatically;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

/**
 * 用药计划执行表
 */
@JsonApiResource(type = "customerdrugprojectexe")
@Table(name = "tnb_customer_drug_project_exe")
@Entity
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class CustomerDrugProjectExe extends BaseEntity {

	private Dicttype result;// 完成情况

	private String remark;// 备注

	private String remarkAdd;// 备注
	
	private User lastUpdateUser;// 更新操作者userid

	private Integer createDateTime;// 创建时间

	private User createUser;

	private Integer lastUpdateDateTime;// 更新时间

	private Double drugNum;// 用药量

	private Dicttype drugSpec;// 规格

	private CustomerDrug customerDrug;

	private Integer exeDate;// 执行时间

	private String useDrugDate;// 计划用药时间

	private Double drugNumPlan;// 计划用药量

	private CustomerDrugProject drugProject;// 用药计划
	
	private ServiceFinishLevel finishLevel;//完成情况标签

	@Transient
	public String getRemarkAdd() { 
		return remarkAdd;
	}

	public void setRemarkAdd(String remarkAdd) {
		this.remarkAdd = remarkAdd;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "finishLevel_id", foreignKey = @ForeignKey(name = "null"))
	public ServiceFinishLevel getFinishLevel() {
		return finishLevel;
	}

	public void setFinishLevel(ServiceFinishLevel finishLevel) {
		this.finishLevel = finishLevel;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "drugproject_id", foreignKey = @ForeignKey(name = "null"))
	public CustomerDrugProject getDrugProject() {
		return drugProject;
	}

	public void setDrugProject(CustomerDrugProject drugProject) {
		this.drugProject = drugProject;
	}

	@Column(name = "drug_num_plan")
	public Double getDrugNumPlan() {
		return drugNumPlan;
	}

	public void setDrugNumPlan(Double drugNumPlan) {
		this.drugNumPlan = drugNumPlan;
	}

	@Column(name = "usedrug_date")
	public String getUseDrugDate() {
		return useDrugDate;
	}

	public void setUseDrugDate(String useDrugDate) {
		this.useDrugDate = useDrugDate;
	}

	@Column(name = "exe_date")
	public Integer getExeDate() {
		return exeDate;
	}

	public void setExeDate(Integer exeDate) {
		this.exeDate = exeDate;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "customerdrug_id", foreignKey = @ForeignKey(name = "null"))
	public CustomerDrug getCustomerDrug() {
		return customerDrug;
	}

	public void setCustomerDrug(CustomerDrug customerDrug) {
		this.customerDrug = customerDrug;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "drug_spec", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getDrugSpec() {
		return drugSpec;
	}

	public void setDrugSpec(Dicttype drugSpec) {
		this.drugSpec = drugSpec;
	}

	@Column(name = "drug_num")
	public Double getDrugNum() {
		return drugNum;
	}

	public void setDrugNum(Double drugNum) {
		this.drugNum = drugNum;
	}

	@Column(name = "createDateTime")
	public Integer getCreateDateTime() {
		return createDateTime;
	}

	public void setCreateDateTime(Integer createDateTime) {
		this.createDateTime = createDateTime;
	}

	@Column(name = "lastUpdateDateTime")
	public Integer getLastUpdateDateTime() {
		return lastUpdateDateTime;
	}

	public void setLastUpdateDateTime(Integer lastUpdateDateTime) {
		this.lastUpdateDateTime = lastUpdateDateTime;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "createuser_id", foreignKey = @ForeignKey(name = "null"))
	public User getCreateUser() {
		return createUser;
	}

	public void setCreateUser(User createUser) {
		this.createUser = createUser;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "lastupdateuser_id", foreignKey = @ForeignKey(name = "null"))
	public User getLastUpdateUser() {
		return lastUpdateUser;
	}

	public void setLastUpdateUser(User lastUpdateUser) {
		this.lastUpdateUser = lastUpdateUser;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "result_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getResult() {
		return result;
	}

	public void setResult(Dicttype result) {
		this.result = result;
	}

	public CustomerDrugProjectExe() {
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

}
